/*
 * Created on 20 ao�t 2005
 *
 */

package picoevo.gp.evolution;

import picoevo.core.evolution.VariationOperator;
import picoevo.core.representation.EvolutionObject;
import picoevo.gp.representation.genericoperators.Element_Node_TreeGP_EphemeralConstant;

public class VariationOperator_Element_TreeGP_EphemeralConstantMutation extends VariationOperator {

	public VariationOperator_Element_TreeGP_EphemeralConstantMutation(String __name) {
		super(__name);
	}

	public VariationOperator_Element_TreeGP_EphemeralConstantMutation(String __name, double __operatorRate) {
		super(__name, __operatorRate);
	}

	@Override
	public void applyOperator(EvolutionObject __element) {
		Element_Node_TreeGP_EphemeralConstant element = (Element_Node_TreeGP_EphemeralConstant) __element;
		if (Math.random() < element.getTemplate().getDoubleProperty("EphemeralConstantMutationRate")) {
			element.setValue(Math.random());
			// Display.debug("muteEphemeral");
		}
	}
}
